import { SettingsModel } from 'server/models/Settings'

export default defineEventHandler(async (event) => {
  try {
    const resume = await SettingsModel.getResume()
    
    if (!resume || Object.keys(resume).length === 0) {
      return {
        success: false,
        message: '简历信息不存在',
        data: null
      }
    }

    return {
      success: true,
      message: '获取简历信息成功',
      data: resume
    }
  } catch (error: any) {
    console.error('获取简历信息失败:', error)
    
    return {
      success: false,
      message: `获取简历信息失败: ${error.message}`,
      data: null
    }
  }
})